package com.train.user.service.impl;

import java.util.List;
import com.train.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.train.user.mapper.UserPlanItemMapper;
import com.train.user.domain.UserPlanItem;
import com.train.user.service.UserPlanItemService;

/**
 * 计划项目Service业务层处理
 *
 * @author train
 * @date 2025-11-15
 */
@Service
public class UserPlanItemServiceImpl implements UserPlanItemService
{
    @Autowired
    private UserPlanItemMapper userPlanItemMapper;

    /**
     * 查询计划项目
     *
     * @param itemId 计划项目主键
     * @return 计划项目
     */
    @Override
    public UserPlanItem selectUserPlanItemByItemId(Long itemId)
    {
        return userPlanItemMapper.selectUserPlanItemByItemId(itemId);
    }

    /**
     * 查询计划项目列表
     *
     * @param userPlanItem 计划项目
     * @return 计划项目
     */
    @Override
    public List<UserPlanItem> selectUserPlanItemList(UserPlanItem userPlanItem)
    {
        return userPlanItemMapper.selectUserPlanItemList(userPlanItem);
    }

    /**
     * 新增计划项目
     *
     * @param userPlanItem 计划项目
     * @return 结果
     */
    @Override
    public int insertUserPlanItem(UserPlanItem userPlanItem)
    {
        userPlanItem.setCreateTime(DateUtils.getNowDate());
        return userPlanItemMapper.insertUserPlanItem(userPlanItem);
    }

    /**
     * 修改计划项目
     *
     * @param userPlanItem 计划项目
     * @return 结果
     */
    @Override
    public int updateUserPlanItem(UserPlanItem userPlanItem)
    {
        return userPlanItemMapper.updateUserPlanItem(userPlanItem);
    }

    /**
     * 批量删除计划项目
     *
     * @param itemIds 需要删除的计划项目主键
     * @return 结果
     */
    @Override
    public int deleteUserPlanItemByItemIds(Long[] itemIds)
    {
        return userPlanItemMapper.deleteUserPlanItemByItemIds(itemIds);
    }

    /**
     * 删除计划项目信息
     *
     * @param itemId 计划项目主键
     * @return 结果
     */
    @Override
    public int deleteUserPlanItemByItemId(Long itemId)
    {
        return userPlanItemMapper.deleteUserPlanItemByItemId(itemId);
    }
}
